package com.gxa.xiaoucomeshome.service.impl;

import com.gxa.xiaoucomeshome.mapper.AddressMapper;
import com.gxa.xiaoucomeshome.pojo.Address;
import com.gxa.xiaoucomeshome.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AddressServiceImpl implements AddressService {

    @Autowired
    AddressMapper addressMapper;


    @Override
    public void insert(Integer u_id,String name,String phone,String sparePhone,String address,String details) {
        addressMapper.insert(u_id,name,phone,sparePhone,address,details);

    }

    @Override
    public List<Address> selectAll(Integer u_id) {
        List<Address> addresses = addressMapper.selectAll(u_id);
        return addresses;
    }

    @Override
    public void update(Address address) {
        addressMapper.update(address);
    }

    @Override
    public Address selectById(Integer id) {
        Address address = addressMapper.selectById(id);
        return address;
    }
}
